import { http } from "@/utils/http";
import { baseUrlApi, filerEmptyVal } from "./utils";

/** 获取表格列 */
export const getCustomColumn = (menuKey: string) => {
  return http.request<any>(
    "get",
    baseUrlApi("/custom/column/detail?menuKey=" + menuKey)
  );
};

/** 保存表格列 */
export const saveCustomColumn = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/custom/column/add"), {
    data
  });
};

/** 导出数据 */
export const getExportData = (api, params?: object) => {
  return http.request<any>("get", baseUrlApi(api), { params });
};

/** 获取配置列表 */
export const getCommon = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/common/list"), { params });
};

/** 获取基础档案-数据字典列表 */
export const getDictionary = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/dictionary/page"), {
    params: filerEmptyVal(params)
  });
};

/** 门店列表 */
export const getStorePage = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/store/simple/page"), {
    params: filerEmptyVal(params)
  });
};

/** 仓库列表 */
export const getDepositoryPage = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/depository/simple/page"), {
    params: filerEmptyVal(params)
  });
};

/** 门店用户列表 */
export const getUsetPage = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/user/page"), {
    params: filerEmptyVal(params)
  });
};
